
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Ic Benchmarks</title>
    <link rel="stylesheet" href="http://yandex.st/highlightjs/7.3/styles/default.min.css">
    <script src="http://yandex.st/highlightjs/7.3/highlight.min.js"></script>
    <script type="text/javascript">hljs.initHighlightingOnLoad();</script>
    <style>
        td { vertical-align: top }
        th { text-align: left; }
        table { border-spacing: 20px 0px; margin-left: -20px }
        body { padding: 9px 17px; }
     </style>
</head>

<body style="background: white; font-family: Helvetica">
    
<h1>01_ABC+lib.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class A {    /* This is just like 01_ABC.ic but with a call to a library method */
  string str;
  int i;

  static int sfunc(boolean b) {
    if (b) {
      {
        int k = 5;
      }
      return 1;
    }
    else {
      A x = new A();
      x.i = 9;
      x.str = "hello";
      return 0;
    }
  }

  void vfunc(A a, int max, int val) {
    int[] arr = new int[max];
    int i = 0;
    while (i &lt; max){
        arr[i] = val;
        i = i + 1;
        Library.printi(i);
        if (a == null)
          break;
    }
  }
}

class B extends A {
    int j;

    void vfunc(A a, int max, int val) {
    }
}

class C {
  static void main(string[] args) {
    A[][] a;
  }
}
</code></pre></td><td><pre class="output">
Global Symbol Table
    Class:  Library
    Class:  A
    Class:  B
    Class:  C

Class Symbol Table: Library
    Static method:  println : string -&gt; void
    Static method:  print : string -&gt; void
    Static method:  printi : int -&gt; void
    Static method:  printb : boolean -&gt; void
    Static method:  readi :  -&gt; int
    Static method:  readln :  -&gt; string
    Static method:  eof :  -&gt; boolean
    Static method:  stoi : string, int -&gt; int
    Static method:  itos : int -&gt; string
    Static method:  stoa : string -&gt; int[]
    Static method:  atos : int[] -&gt; string
    Static method:  random : int -&gt; int
    Static method:  time :  -&gt; int
    Static method:  exit : int -&gt; int

Method Symbol Table: println  (parent = Library)
    Parameter:  s : string

Method Symbol Table: print  (parent = Library)
    Parameter:  s : string

Method Symbol Table: printi  (parent = Library)
    Parameter:  i : int

Method Symbol Table: printb  (parent = Library)
    Parameter:  b : boolean

Method Symbol Table: readi  (parent = Library)

Method Symbol Table: readln  (parent = Library)

Method Symbol Table: eof  (parent = Library)

Method Symbol Table: stoi  (parent = Library)
    Parameter:  s : string
    Parameter:  n : int

Method Symbol Table: itos  (parent = Library)
    Parameter:  i : int

Method Symbol Table: stoa  (parent = Library)
    Parameter:  s : string

Method Symbol Table: atos  (parent = Library)
    Parameter:  a : int[]

Method Symbol Table: random  (parent = Library)
    Parameter:  i : int

Method Symbol Table: time  (parent = Library)

Method Symbol Table: exit  (parent = Library)
    Parameter:  i : int

Class Symbol Table: A
    Field:  str : string
    Field:  i : int
    Static method:  sfunc : boolean -&gt; int
    Virtual method:  vfunc : A, int, int -&gt; void

Method Symbol Table: sfunc  (parent = A)
    Parameter:  b : boolean

Statement Block Symbol Table: @sfunc  (parent = sfunc)

Statement Block Symbol Table: @sfunc  (parent = @sfunc)
    Local variable:  k : int

Statement Block Symbol Table: @sfunc  (parent = sfunc)
    Local variable:  x : A

Method Symbol Table: vfunc  (parent = A)
    Parameter:  a : A
    Parameter:  max : int
    Parameter:  val : int
    Local variable:  arr : int[]
    Local variable:  i : int

Statement Block Symbol Table: @vfunc  (parent = vfunc)

Class Symbol Table: B  (parent = A)
    Field:  j : int
    Virtual method:  vfunc : A, int, int -&gt; void

Method Symbol Table: vfunc  (parent = B)
    Parameter:  a : A
    Parameter:  max : int
    Parameter:  val : int

Class Symbol Table: C
    Static method:  main : string[] -&gt; void

Method Symbol Table: main  (parent = C)
    Parameter:  args : string[]
    Local variable:  a : A[][]
</pre></td></tr></table><h1>01_ABC.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class A {    /* This is just like 01_ABC+lib.ic but without the library call */
  string str;
  int i;

  static int sfunc(boolean b) {
    if (b) {
      {
        int k = 5;
      }
      return 1;
    }
    else {
      A x = new A();
      x.i = 9;
      x.str = "hello";
      return 0;
    }
  }

  void vfunc(A a, int max, int val) {
    int[] arr = new int[max];
    int i = 0;
    while (i &lt; max){
        arr[i] = val;
        i = i + 1;
        // Library.printi(i);
        if (a == null)
          break;
    }
  }
}

class B extends A {
    int j;

    void vfunc(A a, int max, int val) {
    }
}

class C {
  static void main(string[] args) {
    A[][] a;
  }
}
</code></pre></td><td><pre class="output">
Global Symbol Table
    Class:  A
    Class:  B
    Class:  C

Class Symbol Table: A
    Field:  str : string
    Field:  i : int
    Static method:  sfunc : boolean -&gt; int
    Virtual method:  vfunc : A, int, int -&gt; void

Method Symbol Table: sfunc  (parent = A)
    Parameter:  b : boolean

Statement Block Symbol Table: @sfunc  (parent = sfunc)

Statement Block Symbol Table: @sfunc  (parent = @sfunc)
    Local variable:  k : int

Statement Block Symbol Table: @sfunc  (parent = sfunc)
    Local variable:  x : A

Method Symbol Table: vfunc  (parent = A)
    Parameter:  a : A
    Parameter:  max : int
    Parameter:  val : int
    Local variable:  arr : int[]
    Local variable:  i : int

Statement Block Symbol Table: @vfunc  (parent = vfunc)

Class Symbol Table: B  (parent = A)
    Field:  j : int
    Virtual method:  vfunc : A, int, int -&gt; void

Method Symbol Table: vfunc  (parent = B)
    Parameter:  a : A
    Parameter:  max : int
    Parameter:  val : int

Class Symbol Table: C
    Static method:  main : string[] -&gt; void

Method Symbol Table: main  (parent = C)
    Parameter:  args : string[]
    Local variable:  a : A[][]
</pre></td></tr></table><h1>02_2Main.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

		int foo(int a){
			int c; return 0;
		}
		
		static void main(string[] args){}
		
}

class Test2{

	static void main(string[] args){}
}
</code></pre></td><td><pre class="output">13: semantic error; Found more than one main in the file
</pre></td></tr></table><h1>03_This.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	int foo(int a, boolean b){
		this.doo();
		return 0;
	}
	
	void doo(){
		int e;
	}
	
	static void main(string[] args){}
}
</code></pre></td><td><pre class="output">
Global Symbol Table
    Class:  Test

Class Symbol Table: Test
    Virtual method:  foo : int, boolean -&gt; int
    Virtual method:  doo :  -&gt; void
    Static method:  main : string[] -&gt; void

Method Symbol Table: foo  (parent = Test)
    Parameter:  a : int
    Parameter:  b : boolean

Method Symbol Table: doo  (parent = Test)
    Local variable:  e : int

Method Symbol Table: main  (parent = Test)
    Parameter:  args : string[]
</pre></td></tr></table><h1>04_While1.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	int foo(int a, boolean b){
		while(true)
			break;
		return 0;
	}
	
	static void main(string[] args){}
}
</code></pre></td><td><pre class="output">
Global Symbol Table
    Class:  Test

Class Symbol Table: Test
    Virtual method:  foo : int, boolean -&gt; int
    Static method:  main : string[] -&gt; void

Method Symbol Table: foo  (parent = Test)
    Parameter:  a : int
    Parameter:  b : boolean

Method Symbol Table: main  (parent = Test)
    Parameter:  args : string[]
</pre></td></tr></table><h1>05_While2.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	int foo(int a, boolean b){
		while(true){
			int e;
			e =3;
			break;
		}
		return 0;
	}
	
	static void main(string[] args){}
}
</code></pre></td><td><pre class="output">
Global Symbol Table
    Class:  Test

Class Symbol Table: Test
    Virtual method:  foo : int, boolean -&gt; int
    Static method:  main : string[] -&gt; void

Method Symbol Table: foo  (parent = Test)
    Parameter:  a : int
    Parameter:  b : boolean

Statement Block Symbol Table: @foo  (parent = foo)
    Local variable:  e : int

Method Symbol Table: main  (parent = Test)
    Parameter:  args : string[]
</pre></td></tr></table><h1>09_DoubleExtend.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

		int foo(int a){
			int c;
			return 0;
		}
	
}

class Test{
	int d;
}

class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">10: semantic error; Id Test already defined in current scope
</pre></td></tr></table><h1>10_DoubleType.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	int foo(int a,boolean b){
		int c;
		return 0;
	}
	
	int doo(int c){
		if(true)
			int d =3;
		else
			int d =5;
		return 0;
	}
}

class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">12: semantic error; Id d already defined in current scope
</pre></td></tr></table><h1>15_ExtendFuture.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test extends Test1{

		int foo(int a){
			int c;
			return 0;
		}
		
}

class Test1 {
	int d;
}

class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">1: semantic error; Class Test cannot extend Test1, since it's not yet defined
</pre></td></tr></table><h1>16_ExtendItself.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test extends Test{

		int foo(int a){
			int c;
			return 0;
		}
		
}


class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">1: semantic error; Class Test cannot extend Test, since it's not yet defined
</pre></td></tr></table><h1>17_FieldMethodSameName.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{
	boolean foo;
		int foo(int a){
			int c;
			return 0;
		}
		
}


class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">3: semantic error; Method foo is shadowing a field with the same name 
</pre></td></tr></table><h1>18_FieldMethodSameName2.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{
	int d;
		int foo(int a){
			int c;
			return 0;
		}
		
}

class Test1 extends Test{
	
	int d(boolean a){
	 return 0;
	}
	
	static void main(string[] args){}
}
</code></pre></td><td><pre class="output">12: semantic error; Method d is shadowing a field with the same name 
</pre></td></tr></table><h1>19_FieldShadow.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{
	int d;
		int foo(int a){
			int c;
			return 0;
		}
		
}

class Test1 extends Test{
	int d;
}

class C {
  static void main(string[] args) {
      int a;
  }
}
</code></pre></td><td><pre class="output">11: semantic error; Field d is shadowing a field with the same name 
</pre></td></tr></table><h1>20_MethodOverload.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	int foo(int a, boolean b){
		int c;
		return 0;
	}
}

class Test2 extends Test{

	int foo(boolean a, int b){
		int c;
		return 0;
	}
}

class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">11: semantic error; method 'foo' overloads a different method with the same name
</pre></td></tr></table><h1>21_MethodOverload2.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	int foo(int a, boolean b){
		int c;
		return 0;
	}
}

class Test2 extends Test{

	void foo(int d,boolean e){
		int c;
		return ;
	}
}

class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">11: semantic error; method 'foo' overloads a different method with the same name
</pre></td></tr></table><h1>22_MethodShadow.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	int foo(int a, boolean b){
		int a;
		return 0;
	}
}



class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">4: semantic error; Local variable a is shadowing a parameter
</pre></td></tr></table><h1>25_ProbMain2.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

		void foo(int a){
			int c;
		}
		
		static int main(string[] args){ return 0; }
		
}
</code></pre></td><td><pre class="output">7: semantic error; Main method should have 'void' return type
</pre></td></tr></table><h1>26_ProbMain3.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

		void foo(int a){
			int c;
		}
		
		static void main(int args){}
		
}
</code></pre></td><td><pre class="output">7: semantic error; Argument for main method should be 'string[] args'
</pre></td></tr></table><h1>30_StaticCalledVirtual.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class A {
  string str;
  int i;

  static int sfunc() {
   int j;
   j = vfunc();
   return j;
  }

  int vfunc() {
    return 1;
  }
}

class C {
  static void main(string[] args) {
    A a;
	A.sfunc();
  }
}
</code></pre></td><td><pre class="output">7: semantic error; Calling a local virtual method from inside a static method is not allowed
</pre></td></tr></table><h1>31_StaticCalledVirtual2.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class A {
  string str;
  int i;

  static int sfunc() {
   i = 5;
   return i;
  }

  int vfunc() {
    return 1;
  }
}

class C {
  static void main(string[] args) {
    A a;
	A.sfunc();
  }
}
</code></pre></td><td><pre class="output">6: semantic error; Use of field inside static method is not allowed
</pre></td></tr></table><h1>32_StaticCalledVirtual3.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class A {
  string str;
  int i;

  static int sfunc() {
   return vfunc();
  }

  int vfunc() {
    return 1;
  }
}

class C {
  static void main(string[] args) {
    A a;
	A.sfunc();
  }
}
</code></pre></td><td><pre class="output">6: semantic error; Calling a local virtual method from inside a static method is not allowed
</pre></td></tr></table><h1>33_StaticCalledVirtual4.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class A {
  string str;
  int i;

  static int sfunc() {
   return i;
  }

  int vfunc() {
    return 1;
  }
}

class C {
  static void main(string[] args) {
    A a;
	A.sfunc();
  }
}
</code></pre></td><td><pre class="output">6: semantic error; Use a of field inside a static method is not allowed
</pre></td></tr></table><h1>34_this.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	static int hello(int a){
	a =5;
	{
	this.doo();
	} return 0;
	}
	
	int doo(){ return 0; }
	
	static void main(string[] args){}
}
</code></pre></td><td><pre class="output">6: semantic error; Use of 'this' expression inside static method is not allowed
</pre></td></tr></table><h1>35_UnDeclVar.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

		int foo(int a){
			int c;
			b = 3;
			return 0;
		}
		
}


class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">5: semantic error; b not found in symbol table
</pre></td></tr></table><h1>36_UnDeclVar2.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{
	
		int foo(int a){
			int c;
			return 0;
		}
		
}

class Test1 extends Test{
	
	int d(boolean a){
	c =3;
	return 0;
	}
}

class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">13: semantic error; c not found in symbol table
</pre></td></tr></table><h1>37_UnDecMethod.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

		int foo(int a){
			int c;
			doo(3);
			return 0;
		}
		
}


class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">5: semantic error; doo not found in symbol table
</pre></td></tr></table><h1>38_UnDecMethod2.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

		int foo(int a){
			int c;
			Library.doo(3);
			return 0;
		}
		
}

class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">5: semantic error; Method doo doesn't exist
</pre></td></tr></table><h1>39_WrongContinue.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	void foo(int a, boolean b){
		while(true){
			int e;
			e =3;
		}
		continue;
	}
	
}

class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">8: semantic error; Use of 'continue' statement outside of loop not allowed
</pre></td></tr></table><h1>40_WrongThis.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	int foo(int a, boolean b){
		this.doo();
		return 0;
	}
}



class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">4: semantic error; Method Test.doo not found in type table
</pre></td></tr></table><h1>41_WrongType1.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	int foo(int a,boolean b){
		int c;
		c =true;
		return 0;
	}
}

class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">5: semantic error; Invalid assignment of type boolean to variable of type integer
</pre></td></tr></table><h1>42_WrongType2.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	int foo(int a,boolean b){
		int c;
		return 0;
	}
	
	int doo(int c){
		this.foo(2,2);
		return 0;
	}
}

class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">9: semantic error; Method Test.foo is not applicable for the arguments given
</pre></td></tr></table><h1>43_WrongType3.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	int foo(int a,boolean b){
		int c;
		return 0;
	}
	
	static int doo(int c){
		Lib.print(2);
		return 0;
	}
}

class Lib{

	static void print(){
	int c;
	c =3;
	}
}

class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">9: semantic error; Invalid number of arguments for Lib.print
</pre></td></tr></table><h1>44_WrongType4.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	int foo(int a,boolean b){
		int c;
		return 0;
	}
	
	static int doo(int c){
		return true;
	}
}

class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">9: semantic error; Return statement is not of type integer
</pre></td></tr></table><h1>45_WrongType5.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{
	int l;

	int foo(int a,boolean b){
		int c;
		return 0;
	}
	
}

class Test2 extends Test{
	int l;
}

	


class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">12: semantic error; Field l is shadowing a field with the same name 
</pre></td></tr></table><h1>46_WrongType6.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	
	int doo(int c){
		return true;
	}
	
	static void main(string[] args){}
}</code></pre></td><td><pre class="output">5: semantic error; Return statement is not of type integer
</pre></td></tr></table><h1>47_WrongType7.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	int foo(int a,boolean b){
		int c;
		return 0;
	}
	
	int doo(int c){
		boolean e;
		
		e = 3+5;
		return 0;
	}
}

class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">11: semantic error; Invalid assignment of type integer to variable of type boolean
</pre></td></tr></table><h1>48_WrongType8.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	int foo(int a,boolean b){
		int c;
		return 0;
	}
	
	int doo(int c){
		while(3){
		break;
		}
		return 0;
	}
}

class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">9: semantic error; Non boolean condition for while statement
</pre></td></tr></table><h1>49_WrongType9.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	int foo(int a,boolean b){
		int c;
		return 0;
	}
	
	int doo(int c){
		if(c&gt;true){
		c=4;
		}
		return 0;
	}
}

class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">9: semantic error; Invalid logical binary op (&gt;) on non-integer expression
</pre></td></tr></table><h1>50_WrongWhile.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>class Test{

	void foo(int a, boolean b){
		while(true){
			int e;
			e =3;
		}
		break;
	}
}

class C {
  static void main(string[] args) {
   int a;
  }
}
</code></pre></td><td><pre class="output">8: semantic error; Use of 'break' statement outside of loop not allowed
</pre></td></tr></table><h1>Quicksort.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>/* Quicksort &lt;n&gt;: sorts an array of n integers initialized
   with random values.
   Output: the array contents before and after sorting.
*/

//class Library{
//    void println(string s) {}
//    void print(string s) {}
//    void printi(int i) {}
//    int stoi(string s, int i) {}
//   int random(int n) {}
//    void exit(int n) {}
//}

class Quicksort {
    int[] a;

    int partition(int low, int high) {
        int pivot = a[low];
        int i = low;
        int j = high;
        int tmp;
    
        while (true) {
            while (a[i] &lt; pivot) i = i+1;
            while (a[j] &gt; pivot) j = j-1;
    
            if (i &gt;= j) break;
    
            tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
            i = i+1;
            j = j-1;
        }
    
        return j;
    }

    void quicksort(int low, int high) {
        if (low &lt; high) {
            int mid = partition(low, high);
            quicksort(low, mid);
            quicksort(mid+1, high);
        }
    }

    void initArray() {
        int i = 0;
        while(i &lt; a.length) {
            a[i] =  Library.random(a.length*2);
            i = i+1;
        }
    }

    void printArray() {
        int i = 0;
    
        Library.print("Array elements: ");
        while(i&lt;a.length) {
            Library.printi(a[i]);
            Library.print (" ");
            i = i+1;
        }
        Library.print("\n");
    }

    static void main(string[] args) {
        int n;
    
        if (args.length != 1) {
            Library.println("Unspecified array length");
            Library.exit(1);
        }
    
        n = Library.stoi(args[0],0);
        if (n&lt;=0) {
            Library.println("Invalid array length");
            Library.exit(1);
        }
        Quicksort s = new Quicksort();
        s.a = new int[n];
    
        s.initArray();
        s.printArray();
        s.quicksort(0, n-1);
        s.printArray();
    }
}
</code></pre></td><td><pre class="output">
Global Symbol Table
    Class:  Library
    Class:  Quicksort

Class Symbol Table: Library
    Static method:  println : string -&gt; void
    Static method:  print : string -&gt; void
    Static method:  printi : int -&gt; void
    Static method:  printb : boolean -&gt; void
    Static method:  readi :  -&gt; int
    Static method:  readln :  -&gt; string
    Static method:  eof :  -&gt; boolean
    Static method:  stoi : string, int -&gt; int
    Static method:  itos : int -&gt; string
    Static method:  stoa : string -&gt; int[]
    Static method:  atos : int[] -&gt; string
    Static method:  random : int -&gt; int
    Static method:  time :  -&gt; int
    Static method:  exit : int -&gt; int

Method Symbol Table: println  (parent = Library)
    Parameter:  s : string

Method Symbol Table: print  (parent = Library)
    Parameter:  s : string

Method Symbol Table: printi  (parent = Library)
    Parameter:  i : int

Method Symbol Table: printb  (parent = Library)
    Parameter:  b : boolean

Method Symbol Table: readi  (parent = Library)

Method Symbol Table: readln  (parent = Library)

Method Symbol Table: eof  (parent = Library)

Method Symbol Table: stoi  (parent = Library)
    Parameter:  s : string
    Parameter:  n : int

Method Symbol Table: itos  (parent = Library)
    Parameter:  i : int

Method Symbol Table: stoa  (parent = Library)
    Parameter:  s : string

Method Symbol Table: atos  (parent = Library)
    Parameter:  a : int[]

Method Symbol Table: random  (parent = Library)
    Parameter:  i : int

Method Symbol Table: time  (parent = Library)

Method Symbol Table: exit  (parent = Library)
    Parameter:  i : int

Class Symbol Table: Quicksort
    Field:  a : int[]
    Virtual method:  partition : int, int -&gt; int
    Virtual method:  quicksort : int, int -&gt; void
    Virtual method:  initArray :  -&gt; void
    Virtual method:  printArray :  -&gt; void
    Static method:  main : string[] -&gt; void

Method Symbol Table: partition  (parent = Quicksort)
    Parameter:  low : int
    Parameter:  high : int
    Local variable:  pivot : int
    Local variable:  i : int
    Local variable:  j : int
    Local variable:  tmp : int

Statement Block Symbol Table: @partition  (parent = partition)

Method Symbol Table: quicksort  (parent = Quicksort)
    Parameter:  low : int
    Parameter:  high : int

Statement Block Symbol Table: @quicksort  (parent = quicksort)
    Local variable:  mid : int

Method Symbol Table: initArray  (parent = Quicksort)
    Local variable:  i : int

Statement Block Symbol Table: @initArray  (parent = initArray)

Method Symbol Table: printArray  (parent = Quicksort)
    Local variable:  i : int

Statement Block Symbol Table: @printArray  (parent = printArray)

Method Symbol Table: main  (parent = Quicksort)
    Parameter:  args : string[]
    Local variable:  n : int
    Local variable:  s : Quicksort

Statement Block Symbol Table: @main  (parent = main)

Statement Block Symbol Table: @main  (parent = main)
</pre></td></tr></table><h1>Sieve.ic</h1><table style="width: 100%"><tr><th>Input</th><th>Output</th></tr><tr><td><pre class="input language-java"><code>/**
 * Sieve &lt;n&gt;: finds all prime numbers less than n.
 * Output: all prime numbers less than n.
 */

//class Library {
//  void println(string s) {}
//  void print(string s) {}
//  void printi(int i) {}
//  int stoi(string s, int error) {}
//}


class Sieve {

  int[] num;

  void initArray() {
    int i = 0;
    while (i &lt; num.length) {
      num[i] = i;
      i=i+1;
    }
  }

  void sieveAll() {
    int i = 2;
    while (i &lt; num.length) {
      sieve(i);
      i=i+1; 
    }
  }

  void sieve(int n) {
    int i = 2*n;
    while (i &lt; num.length) {
      num[i] = 0;
      i=i+n;
    }
  }

  void printPrimes() {
    int i = 2;
    Library.print("Primes less than ");
    Library.printi(num.length);
    Library.print(": ");
    while (i &lt; num.length) {
      if (num[i] != 0) {
        Library.printi(num[i]);
        Library.print(" ");
      }
      i=i+1;
    }
  }


  static void main(string[] args) {
    (new Sieve()).test(args);
  }

  void test(string[] args) {
    int n;

    if (args.length != 1) {
      Library.println("Unspecified number.");
      return;
    }

    Library.println("");
    n = Library.stoi(args[0], 0);
    if (n &lt;= 0) {
      Library.println("Invalid array length");
      return;
    }
    num = new int[n];

    initArray();
    sieveAll();
    printPrimes();
    Library.println("");

  }

}
</code></pre></td><td><pre class="output">
Global Symbol Table
    Class:  Library
    Class:  Sieve

Class Symbol Table: Library
    Static method:  println : string -&gt; void
    Static method:  print : string -&gt; void
    Static method:  printi : int -&gt; void
    Static method:  printb : boolean -&gt; void
    Static method:  readi :  -&gt; int
    Static method:  readln :  -&gt; string
    Static method:  eof :  -&gt; boolean
    Static method:  stoi : string, int -&gt; int
    Static method:  itos : int -&gt; string
    Static method:  stoa : string -&gt; int[]
    Static method:  atos : int[] -&gt; string
    Static method:  random : int -&gt; int
    Static method:  time :  -&gt; int
    Static method:  exit : int -&gt; int

Method Symbol Table: println  (parent = Library)
    Parameter:  s : string

Method Symbol Table: print  (parent = Library)
    Parameter:  s : string

Method Symbol Table: printi  (parent = Library)
    Parameter:  i : int

Method Symbol Table: printb  (parent = Library)
    Parameter:  b : boolean

Method Symbol Table: readi  (parent = Library)

Method Symbol Table: readln  (parent = Library)

Method Symbol Table: eof  (parent = Library)

Method Symbol Table: stoi  (parent = Library)
    Parameter:  s : string
    Parameter:  n : int

Method Symbol Table: itos  (parent = Library)
    Parameter:  i : int

Method Symbol Table: stoa  (parent = Library)
    Parameter:  s : string

Method Symbol Table: atos  (parent = Library)
    Parameter:  a : int[]

Method Symbol Table: random  (parent = Library)
    Parameter:  i : int

Method Symbol Table: time  (parent = Library)

Method Symbol Table: exit  (parent = Library)
    Parameter:  i : int

Class Symbol Table: Sieve
    Field:  num : int[]
    Virtual method:  initArray :  -&gt; void
    Virtual method:  sieveAll :  -&gt; void
    Virtual method:  sieve : int -&gt; void
    Virtual method:  printPrimes :  -&gt; void
    Static method:  main : string[] -&gt; void
    Virtual method:  test : string[] -&gt; void

Method Symbol Table: initArray  (parent = Sieve)
    Local variable:  i : int

Statement Block Symbol Table: @initArray  (parent = initArray)

Method Symbol Table: sieveAll  (parent = Sieve)
    Local variable:  i : int

Statement Block Symbol Table: @sieveAll  (parent = sieveAll)

Method Symbol Table: sieve  (parent = Sieve)
    Parameter:  n : int
    Local variable:  i : int

Statement Block Symbol Table: @sieve  (parent = sieve)

Method Symbol Table: printPrimes  (parent = Sieve)
    Local variable:  i : int

Statement Block Symbol Table: @printPrimes  (parent = printPrimes)

Statement Block Symbol Table: @printPrimes  (parent = @printPrimes)

Method Symbol Table: main  (parent = Sieve)
    Parameter:  args : string[]

Method Symbol Table: test  (parent = Sieve)
    Parameter:  args : string[]
    Local variable:  n : int

Statement Block Symbol Table: @test  (parent = test)

Statement Block Symbol Table: @test  (parent = test)
</pre></td></tr></table>

</body>
</html>
    
